#include "Newton.h"

using namespace std;

int main(){
    int n=9;
    vector<double> x={0,0,3,3,5,5,8,8,13,13};
    vector<double> y={0,75,225,77,383,80,623,74,993,72};
    vector<vector<double>> c(10,vector<double>(10,0));
    c[0]=x;
    for (int i=0;i<5;i++){
        c[1][2*i]=y[2*i+1];
    }
    for (int i=0;i<4;i++){
        c[1][2*i+1]=(y[2*i+2]-y[2*i])/(x[2*i+2]-x[2*i]);
    }
    for (int i=2;i<10;i++){
        for (int j=0;j<10-i;j++){
            c[i][j]=(c[i-1][j+1]-c[i-1][j])/(x[j+i]-x[j]);
        }
    }
    double res;
    for (int i=0;i<10;i++){
        double temp=c[i][0];
        for (int j=0;j<i;j++){
            temp=temp*(10-x[j]);
        }
        res=res+temp;
    }
    cout << res << endl;


    return 0;
}